#!/usr/bin/perl -w
use 5.010;

$_="home,sweet home!";
s/home/cave/g;
print "$_\n";

$_="Input data\t may have    extra whitespace.";
s/\s+/ /g;
print "$_\n";

$_="  Input data\t may have    extra whitespace.   ";
s/^\s+|\s+$//;
print "$_\n";

$_="https://www.baidu.com";
s#^https?://#http://#;
print "$_\n";

$file_name="hello ,everyone.";
$file_name=~s#^.*,##;
print "$file_name\n";

$_="I saw Barney with Fred.";
s/(fred|barney)/\L$1/gi;
print "$_\n";
s/(fred|barney)/\U$1/gi;
print "$_\n";
s/(\w+) with (\w+)/\U$2\E with $1/i;
print "$_\n";
s/(fred|barney)/\u$1/ig;
print "$_\n";
s/(fred|barney)/\u\L$1/ig;
print "$_\n";
$name=wIlam;
print "Hello, \L\u$name\E,would you like to play a game?\n";